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

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

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

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

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

f.o = m
f.r = m
f.u = m
f.z = d
m.o = d
m.s = d
m.r = j
m.p = h
d.p = j
d.r = c
d.w = f
c.s = f
c.o = f
c.z = m
c.y = l
l.s = f
l.o = f
l.z = j
l.y = c
h.s = f
h.o = f
h.z = m
h.y = c
j.o = d
j.s = d
j.r = m
j.p = c
assert d.r.z.o.r.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.r: B = None
        self.u: B = None
        self.z: C = None
        self.txt = txt

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

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

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

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

f.o = m
f.r = m
f.u = m
f.z = d
m.o = d
m.s = d
m.r = j
m.p = h
d.p = j
d.r = c
d.w = f
c.s = f
c.o = f
c.z = m
c.y = l
l.s = f
l.o = f
l.z = j
l.y = c
h.s = f
h.o = f
h.z = m
h.y = c
j.o = d
j.s = d
j.r = m
j.p = c
assert d.r.z.o.r.txt == "c"