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

class B:
    def __init__(self, txt: str):
        self.z: C = None
        self.q: C = None
        self.p: B = None
        self.o: A = None
        self.txt = txt

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

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

b = A("b")
a = B("a")
k = C("k")
m = D("m")
i = B("i")
g = A("g")
e = C("e")
f = B("f")

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

class B:
    def __init__(self, txt: str):
        self.z: C = None
        self.q: C = None
        self.p: B = None
        self.o: A = None
        self.txt = txt

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

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

b = A("b")
a = B("a")
k = C("k")
m = D("m")
i = B("i")
g = A("g")
e = C("e")
f = B("f")

b.t = m
b.r = m
b.x = f
b.u = a
a.z = e
a.q = k
a.p = i
a.o = b
k.y = g
k.x = a
k.p = i
k.z = e
m.u = g
m.o = a
m.p = b
m.y = b
i.z = k
i.q = k
i.p = f
i.o = g
g.t = m
g.r = m
g.x = a
g.u = f
e.y = g
e.x = i
e.p = i
e.z = k
f.z = k
f.q = e
f.p = i
f.o = b
assert i.q.y.u.txt == "f"