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

class B:
    def __init__(self, txt: str):
        self.u: E = None
        self.p: D = None
        self.v: E = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.q: D = None
        self.p: A = None
        self.z: F = None
        self.y: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: B = None
        self.t: A = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.u: E = None
        self.p: D = None
        self.v: E = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.q: D = None
        self.p: A = None
        self.z: F = None
        self.y: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: B = None
        self.t: A = None
        self.txt = txt

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

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