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

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

class C:
    def __init__(self, txt: str):
        self.w: D = None
        self.q: B = None
        self.y: E = None
        self.o: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.t: C = None
        self.z: C = None
        self.p: E = None
        self.v: D = None
        self.o: D = None
        self.txt = txt

l = A("l")
f = B("f")
m = C("m")
i = D("i")
k = E("k")
e = E("e")
g = C("g")
b = A("b")
a = E("a")

l.x = k
f.p = l
f.x = m
m.w = i
m.q = f
m.y = k
m.o = k
i.x = b
i.q = f
k.t = g
k.z = g
k.p = e
k.v = i
k.o = i
e.t = m
e.z = m
e.p = k
e.v = i
e.o = i
g.w = i
g.q = f
g.y = e
g.o = e
b.x = e
a.t = m
a.z = g
a.p = k
a.v = i
a.o = i
assert g.q.x.q.p.x.p.t.q.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.w: D = None
        self.q: B = None
        self.y: E = None
        self.o: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.t: C = None
        self.z: C = None
        self.p: E = None
        self.v: D = None
        self.o: D = None
        self.txt = txt

l = A("l")
f = B("f")
m = C("m")
i = D("i")
k = E("k")
e = E("e")
g = C("g")
b = A("b")
a = E("a")

l.x = k
f.p = l
f.x = m
m.w = i
m.q = f
m.y = k
m.o = k
i.x = b
i.q = f
k.t = g
k.z = g
k.p = e
k.v = i
k.o = i
e.t = m
e.z = m
e.p = k
e.v = i
e.o = i
g.w = i
g.q = f
g.y = e
g.o = e
b.x = e
a.t = m
a.z = g
a.p = k
a.v = i
a.o = i
assert g.q.x.q.p.x.p.t.q.x.txt == "m"