class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.q: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: E = None
        self.q: C = None
        self.v: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: A = None
        self.w: B = None
        self.z: B = None
        self.x: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: B = None
        self.x: B = None
        self.t: C = None
        self.txt = txt

j = A("j")
g = B("g")
k = C("k")
h = D("h")
b = E("b")
f = E("f")
a = D("a")

j.v = k
j.q = k
g.s = b
g.q = k
g.v = a
k.q = j
k.w = g
k.z = g
k.x = g
h.x = k
b.o = g
b.x = g
b.t = k
f.o = g
f.x = g
f.t = k
a.x = k
assert a.x.x.s.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.q: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: E = None
        self.q: C = None
        self.v: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: A = None
        self.w: B = None
        self.z: B = None
        self.x: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: B = None
        self.x: B = None
        self.t: C = None
        self.txt = txt

j = A("j")
g = B("g")
k = C("k")
h = D("h")
b = E("b")
f = E("f")
a = D("a")

j.v = k
j.q = k
g.s = b
g.q = k
g.v = a
k.q = j
k.w = g
k.z = g
k.x = g
h.x = k
b.o = g
b.x = g
b.t = k
f.o = g
f.x = g
f.t = k
a.x = k
assert a.x.x.s.txt == "b"