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

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

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

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

m = A("m")
b = B("b")
i = C("i")
n = D("n")
h = A("h")
d = A("d")
k = B("k")
j = A("j")
e = C("e")
f = B("f")

m.o = d
b.t = h
b.r = k
b.x = k
i.z = e
i.q = k
n.t = e
h.o = j
d.o = j
k.t = d
k.r = f
k.x = f
j.o = m
e.z = i
e.q = f
f.t = m
f.r = k
f.x = b
assert b.t.o.o.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.txt = txt

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

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

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

m = A("m")
b = B("b")
i = C("i")
n = D("n")
h = A("h")
d = A("d")
k = B("k")
j = A("j")
e = C("e")
f = B("f")

m.o = d
b.t = h
b.r = k
b.x = k
i.z = e
i.q = k
n.t = e
h.o = j
d.o = j
k.t = d
k.r = f
k.x = f
j.o = m
e.z = i
e.q = f
f.t = m
f.r = k
f.x = b
assert b.t.o.o.o.o.txt == "j"