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

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

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

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

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

g.x = a
j.u = a
j.p = a
m.t = b
m.z = b
m.r = g
m.y = g
l.t = g
l.x = k
l.o = j
b.t = m
b.z = m
b.r = g
b.y = g
k.t = g
k.x = l
k.o = j
a.u = j
a.p = j
assert m.t.r.x.p.u.u.p.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

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

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

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

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

g.x = a
j.u = a
j.p = a
m.t = b
m.z = b
m.r = g
m.y = g
l.t = g
l.x = k
l.o = j
b.t = m
b.z = m
b.r = g
b.y = g
k.t = g
k.x = l
k.o = j
a.u = j
a.p = j
assert m.t.r.x.p.u.u.p.txt == "a"