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

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

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

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

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

f = A("f")
n = B("n")
b = C("b")
a = D("a")
j = E("j")
c = A("c")
g = C("g")
l = A("l")

f.p = g
f.t = b
n.u = g
b.u = n
b.w = n
b.y = n
b.z = n
b.o = j
a.z = j
a.u = j
j.x = n
j.u = n
j.p = g
j.z = c
c.p = g
c.t = g
g.u = n
g.w = n
g.y = n
g.z = n
g.o = j
l.p = b
l.t = b
assert a.u.u.u.o.z.t.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.t: C = None
        self.txt = txt

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

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

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

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

f = A("f")
n = B("n")
b = C("b")
a = D("a")
j = E("j")
c = A("c")
g = C("g")
l = A("l")

f.p = g
f.t = b
n.u = g
b.u = n
b.w = n
b.y = n
b.z = n
b.o = j
a.z = j
a.u = j
j.x = n
j.u = n
j.p = g
j.z = c
c.p = g
c.t = g
g.u = n
g.w = n
g.y = n
g.z = n
g.o = j
l.p = b
l.t = b
assert a.u.u.u.o.z.t.txt == "g"