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

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

class C:
    def __init__(self, txt: str):
        self.q: F = None
        self.p: B = None
        self.s: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: B = None
        self.y: F = None
        self.u: F = None
        self.r: B = None
        self.txt = txt

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

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

a = A("a")
e = B("e")
d = C("d")
k = D("k")
i = E("i")
b = F("b")
n = D("n")

a.o = e
a.x = i
a.u = d
e.x = a
d.q = b
d.s = b
d.p = e
k.x = e
k.r = e
k.y = b
k.u = b
i.v = n
i.o = d
b.q = e
b.s = d
n.x = e
n.r = e
n.y = b
n.u = b
assert n.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.x: E = None
        self.u: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: F = None
        self.p: B = None
        self.s: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: B = None
        self.y: F = None
        self.u: F = None
        self.r: B = None
        self.txt = txt

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

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

a = A("a")
e = B("e")
d = C("d")
k = D("k")
i = E("i")
b = F("b")
n = D("n")

a.o = e
a.x = i
a.u = d
e.x = a
d.q = b
d.s = b
d.p = e
k.x = e
k.r = e
k.y = b
k.u = b
i.v = n
i.o = d
b.q = e
b.s = d
n.x = e
n.r = e
n.y = b
n.u = b
assert n.x.x.x.txt == "i"