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

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

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

class D:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

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

d = A("d")
n = B("n")
j = C("j")
h = D("h")
a = E("a")
e = C("e")
b = E("b")
m = B("m")

d.p = h
n.x = m
n.r = h
n.v = h
n.s = h
n.p = b
j.t = m
j.o = e
j.p = h
j.v = a
h.y = e
a.u = d
a.v = d
a.z = b
e.t = m
e.o = j
e.p = h
e.v = a
b.u = d
b.v = d
b.z = a
m.x = n
m.r = h
m.v = h
m.s = h
m.p = a
assert d.p.y.t.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

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

d = A("d")
n = B("n")
j = C("j")
h = D("h")
a = E("a")
e = C("e")
b = E("b")
m = B("m")

d.p = h
n.x = m
n.r = h
n.v = h
n.s = h
n.p = b
j.t = m
j.o = e
j.p = h
j.v = a
h.y = e
a.u = d
a.v = d
a.z = b
e.t = m
e.o = j
e.p = h
e.v = a
b.u = d
b.v = d
b.z = a
m.x = n
m.r = h
m.v = h
m.s = h
m.p = a
assert d.p.y.t.x.x.txt == "m"