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

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

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

class D:
    def __init__(self, txt: str):
        self.s: B = None
        self.w: A = None
        self.o: D = None
        self.p: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: B = None
        self.r: B = None
        self.u: B = None
        self.txt = txt

h = A("h")
i = B("i")
k = C("k")
d = D("d")
j = E("j")
e = B("e")
c = D("c")
g = A("g")

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

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

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

class D:
    def __init__(self, txt: str):
        self.s: B = None
        self.w: A = None
        self.o: D = None
        self.p: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: B = None
        self.r: B = None
        self.u: B = None
        self.txt = txt

h = A("h")
i = B("i")
k = C("k")
d = D("d")
j = E("j")
e = B("e")
c = D("c")
g = A("g")

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