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

class B:
    def __init__(self, txt: str):
        self.p: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.s: C = None
        self.x: D = None
        self.y: A = None
        self.r: D = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.p: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.s: C = None
        self.x: D = None
        self.y: A = None
        self.r: D = None
        self.txt = txt

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

d.x = f
d.z = a
d.y = a
d.t = g
g.p = e
h.y = g
h.x = a
b.r = k
b.q = d
b.z = g
b.o = c
i.s = h
i.x = e
i.y = f
i.r = b
f.x = a
f.z = a
f.y = a
f.t = g
c.y = g
c.x = a
k.y = g
k.x = a
a.x = f
a.y = f
a.z = d
a.t = g
e.r = c
e.q = d
e.z = g
e.o = k
assert b.r.y.p.z.p.o.x.txt == "a"