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

class B:
    def __init__(self, txt: str):
        self.q: D = None
        self.o: D = None
        self.v: A = None
        self.w: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.q: A = None
        self.u: A = None
        self.s: B = None
        self.v: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.s: A = None
        self.v: D = None
        self.y: B = None
        self.z: E = None
        self.r: B = None
        self.txt = txt

c = A("c")
l = B("l")
i = C("i")
d = D("d")
f = E("f")
k = F("k")

c.o = f
l.q = d
l.o = d
l.v = c
l.w = f
i.u = d
i.x = c
d.q = c
d.u = c
d.s = l
d.v = i
f.z = c
f.p = l
k.s = c
k.v = d
k.y = l
k.r = l
k.z = f
assert i.x.o.z.o.z.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: D = None
        self.o: D = None
        self.v: A = None
        self.w: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.q: A = None
        self.u: A = None
        self.s: B = None
        self.v: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.s: A = None
        self.v: D = None
        self.y: B = None
        self.z: E = None
        self.r: B = None
        self.txt = txt

c = A("c")
l = B("l")
i = C("i")
d = D("d")
f = E("f")
k = F("k")

c.o = f
l.q = d
l.o = d
l.v = c
l.w = f
i.u = d
i.x = c
d.q = c
d.u = c
d.s = l
d.v = i
f.z = c
f.p = l
k.s = c
k.v = d
k.y = l
k.r = l
k.z = f
assert i.x.o.z.o.z.o.txt == "f"