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

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

class C:
    def __init__(self, txt: str):
        self.p: E = None
        self.v: B = None
        self.r: E = None
        self.txt = txt

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

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

i = A("i")
j = B("j")
c = C("c")
d = D("d")
f = E("f")
n = D("n")

i.z = j
i.q = d
i.p = f
j.t = n
j.p = d
c.p = f
c.r = f
c.v = j
d.o = i
d.r = c
d.x = c
f.t = n
f.q = n
f.r = n
f.u = j
n.o = i
n.r = c
n.x = c
assert j.p.x.p.u.p.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.q: D = None
        self.p: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: E = None
        self.v: B = None
        self.r: E = None
        self.txt = txt

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

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

i = A("i")
j = B("j")
c = C("c")
d = D("d")
f = E("f")
n = D("n")

i.z = j
i.q = d
i.p = f
j.t = n
j.p = d
c.p = f
c.r = f
c.v = j
d.o = i
d.r = c
d.x = c
f.t = n
f.q = n
f.r = n
f.u = j
n.o = i
n.r = c
n.x = c
assert j.p.x.p.u.p.txt == "d"