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

class B:
    def __init__(self, txt: str):
        self.z: C = None
        self.r: F = None
        self.u: E = None
        self.p: C = None
        self.o: A = None
        self.s: F = None
        self.q: C = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.w: A = None
        self.p: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.r: G = None
        self.t: A = None
        self.q: H = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.o: D = None
        self.r: H = None
        self.v: F = None
        self.z: F = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.z: D = None
        self.q: E = None
        self.txt = txt

a = A("a")
l = B("l")
c = C("c")
k = D("k")
j = E("j")
e = F("e")
g = G("g")
f = H("f")
d = C("d")

a.q = f
l.z = c
l.r = e
l.s = e
l.u = j
l.p = d
l.q = d
l.o = a
c.x = k
k.r = d
k.u = c
j.w = a
j.p = l
e.r = g
e.t = a
e.q = f
g.o = k
g.r = f
g.v = e
g.z = e
f.z = k
f.q = j
d.x = k
assert e.q.z.u.x.u.x.txt == "
class A:
    def __init__(self, txt: str):
        self.q: H = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: C = None
        self.r: F = None
        self.u: E = None
        self.p: C = None
        self.o: A = None
        self.s: F = None
        self.q: C = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.w: A = None
        self.p: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.r: G = None
        self.t: A = None
        self.q: H = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.o: D = None
        self.r: H = None
        self.v: F = None
        self.z: F = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.z: D = None
        self.q: E = None
        self.txt = txt

a = A("a")
l = B("l")
c = C("c")
k = D("k")
j = E("j")
e = F("e")
g = G("g")
f = H("f")
d = C("d")

a.q = f
l.z = c
l.r = e
l.s = e
l.u = j
l.p = d
l.q = d
l.o = a
c.x = k
k.r = d
k.u = c
j.w = a
j.p = l
e.r = g
e.t = a
e.q = f
g.o = k
g.r = f
g.v = e
g.z = e
f.z = k
f.q = j
d.x = k
assert e.q.z.u.x.u.x.txt == "k"