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

class B:
    def __init__(self, txt: str):
        self.r: G = None
        self.z: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: F = None
        self.w: D = None
        self.x: C = None
        self.v: G = None
        self.z: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: B = None
        self.u: B = None
        self.p: B = None
        self.t: C = None
        self.r: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.w: D = None
        self.z: B = None
        self.y: F = None
        self.q: G = None
        self.t: B = None
        self.p: C = None
        self.v: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.o: C = None
        self.r: C = None
        self.txt = txt

h = A("h")
e = B("e")
f = C("f")
c = D("c")
d = E("d")
l = F("l")
j = G("j")
n = C("n")
a = A("a")

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

class B:
    def __init__(self, txt: str):
        self.r: G = None
        self.z: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: F = None
        self.w: D = None
        self.x: C = None
        self.v: G = None
        self.z: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: B = None
        self.u: B = None
        self.p: B = None
        self.t: C = None
        self.r: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.w: D = None
        self.z: B = None
        self.y: F = None
        self.q: G = None
        self.t: B = None
        self.p: C = None
        self.v: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.o: C = None
        self.r: C = None
        self.txt = txt

h = A("h")
e = B("e")
f = C("f")
c = D("c")
d = E("d")
l = F("l")
j = G("j")
n = C("n")
a = A("a")

h.x = a
e.r = j
e.z = n
f.y = l
f.w = c
f.z = c
f.x = n
f.v = j
c.v = e
c.u = e
c.p = e
c.t = n
c.r = l
d.w = c
d.z = e
d.t = e
d.y = l
d.q = j
d.p = f
d.v = f
l.u = e
j.o = n
j.r = n
n.y = l
n.w = c
n.z = c
n.x = f
n.v = j
a.x = h
assert a.x.x.x.txt == "h"