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

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

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

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

f = A("f")
m = B("m")
c = C("c")
l = D("l")
b = D("b")
j = C("j")
e = D("e")
d = A("d")
h = B("h")

f.x = l
f.o = c
f.p = c
f.s = h
m.z = h
m.o = h
m.x = f
c.r = d
l.t = e
b.t = l
j.r = f
e.t = b
d.x = b
d.o = j
d.p = j
d.s = h
h.z = m
h.o = m
h.x = f
assert d.o.r.x.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.o: C = None
        self.s: B = None
        self.p: C = None
        self.txt = txt

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

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

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

f = A("f")
m = B("m")
c = C("c")
l = D("l")
b = D("b")
j = C("j")
e = D("e")
d = A("d")
h = B("h")

f.x = l
f.o = c
f.p = c
f.s = h
m.z = h
m.o = h
m.x = f
c.r = d
l.t = e
b.t = l
j.r = f
e.t = b
d.x = b
d.o = j
d.p = j
d.s = h
h.z = m
h.o = m
h.x = f
assert d.o.r.x.t.t.txt == "b"