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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.p: E = None
        self.s: A = None
        self.v: E = None
        self.u: C = None
        self.t: C = None
        self.z: B = None
        self.txt = txt

i = A("i")
f = B("f")
m = C("m")
b = D("b")
d = E("d")
c = F("c")

i.y = b
i.x = m
f.q = m
f.o = c
f.x = d
m.v = b
b.v = i
b.s = d
b.r = d
b.x = f
d.x = i
c.p = d
c.v = d
c.s = i
c.u = m
c.t = m
c.z = f
assert f.o.t.v.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.x: C = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.p: E = None
        self.s: A = None
        self.v: E = None
        self.u: C = None
        self.t: C = None
        self.z: B = None
        self.txt = txt

i = A("i")
f = B("f")
m = C("m")
b = D("b")
d = E("d")
c = F("c")

i.y = b
i.x = m
f.q = m
f.o = c
f.x = d
m.v = b
b.v = i
b.s = d
b.r = d
b.x = f
d.x = i
c.p = d
c.v = d
c.s = i
c.u = m
c.t = m
c.z = f
assert f.o.t.v.x.x.x.txt == "i"