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

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

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

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

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

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

l = A("l")
f = B("f")
d = C("d")
m = D("m")
e = E("e")
i = F("i")

l.r = m
l.o = d
l.u = d
l.z = e
f.o = d
d.s = e
d.o = m
m.r = l
m.t = l
m.p = f
e.z = d
e.o = f
e.s = f
i.q = l
assert f.o.s.z.s.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.o: C = None
        self.u: C = None
        self.z: E = None
        self.txt = txt

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

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

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

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

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

l = A("l")
f = B("f")
d = C("d")
m = D("m")
e = E("e")
i = F("i")

l.r = m
l.o = d
l.u = d
l.z = e
f.o = d
d.s = e
d.o = m
m.r = l
m.t = l
m.p = f
e.z = d
e.o = f
e.s = f
i.q = l
assert f.o.s.z.s.txt == "e"