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

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: E = None
        self.r: D = None
        self.q: E = None
        self.v: B = None
        self.x: E = None
        self.txt = txt

b = A("b")
l = B("l")
e = C("e")
d = D("d")
j = E("j")
m = E("m")

b.x = e
b.u = d
b.v = d
b.t = m
l.q = d
l.u = d
e.o = m
d.p = l
j.s = m
j.q = m
j.x = m
j.r = d
j.v = l
m.s = j
m.q = j
m.x = j
m.r = d
m.v = l
assert d.p.u.p.u.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.u: D = None
        self.v: D = None
        self.t: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: E = None
        self.r: D = None
        self.q: E = None
        self.v: B = None
        self.x: E = None
        self.txt = txt

b = A("b")
l = B("l")
e = C("e")
d = D("d")
j = E("j")
m = E("m")

b.x = e
b.u = d
b.v = d
b.t = m
l.q = d
l.u = d
e.o = m
d.p = l
j.s = m
j.q = m
j.x = m
j.r = d
j.v = l
m.s = j
m.q = j
m.x = j
m.r = d
m.v = l
assert d.p.u.p.u.txt == "d"