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

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

class C:
    def __init__(self, txt: str):
        self.p: A = None
        self.v: D = None
        self.w: D = None
        self.z: B = None
        self.txt = txt

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

g = A("g")
b = B("b")
a = C("a")
m = D("m")
f = C("f")
d = A("d")
n = D("n")
k = A("k")
c = B("c")
e = D("e")

g.t = n
g.u = e
b.t = c
b.z = c
a.p = g
a.v = n
a.w = e
a.z = c
m.x = g
m.t = b
m.p = c
m.y = d
f.p = k
f.v = m
f.w = m
f.z = c
d.t = e
d.u = n
n.x = k
n.t = c
n.p = b
n.y = d
k.t = m
k.u = e
c.t = b
c.z = b
e.x = g
e.t = c
e.p = c
e.y = k
assert d.t.x.t.p.z.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.u: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: A = None
        self.v: D = None
        self.w: D = None
        self.z: B = None
        self.txt = txt

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

g = A("g")
b = B("b")
a = C("a")
m = D("m")
f = C("f")
d = A("d")
n = D("n")
k = A("k")
c = B("c")
e = D("e")

g.t = n
g.u = e
b.t = c
b.z = c
a.p = g
a.v = n
a.w = e
a.z = c
m.x = g
m.t = b
m.p = c
m.y = d
f.p = k
f.v = m
f.w = m
f.z = c
d.t = e
d.u = n
n.x = k
n.t = c
n.p = b
n.y = d
k.t = m
k.u = e
c.t = b
c.z = b
e.x = g
e.t = c
e.p = c
e.y = k
assert d.t.x.t.p.z.txt == "c"