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

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

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

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

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

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

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

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

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

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

e.z = k
e.t = g
e.x = m
b.x = g
b.r = m
b.u = l
b.z = d
g.p = j
g.s = j
m.x = d
k.x = j
j.z = m
j.t = g
j.x = k
d.z = m
d.x = m
d.t = g
l.x = g
l.r = m
l.u = b
l.z = j
assert d.x.x.t.p.z.x.txt == "d"