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

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

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

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

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

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

i = A("i")
h = B("h")
n = C("n")
c = D("c")
d = E("d")
f = F("f")

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

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

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

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

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

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

i = A("i")
h = B("h")
n = C("n")
c = D("c")
d = E("d")
f = F("f")

i.u = n
h.x = n
h.v = f
n.s = i
n.o = i
n.v = i
c.p = h
c.z = n
c.s = f
c.q = f
c.x = i
c.u = d
d.w = n
d.r = i
d.p = f
f.r = n
f.q = i
assert c.p.x.s.u.v.txt == "i"