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

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

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

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

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

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

k = A("k")
i = B("i")
n = C("n")
g = D("g")
f = E("f")
l = F("l")

k.t = f
k.u = n
i.x = k
i.q = l
i.s = l
i.p = g
i.r = f
i.z = f
n.p = k
g.x = k
g.o = k
g.u = n
f.r = l
l.p = k
l.z = f
l.y = g
l.q = g
assert l.p.t.r.q.o.txt == "
class A:
    def __init__(self, txt: str):
        self.t: E = None
        self.u: C = None
        self.txt = txt

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

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

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

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

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

k = A("k")
i = B("i")
n = C("n")
g = D("g")
f = E("f")
l = F("l")

k.t = f
k.u = n
i.x = k
i.q = l
i.s = l
i.p = g
i.r = f
i.z = f
n.p = k
g.x = k
g.o = k
g.u = n
f.r = l
l.p = k
l.z = f
l.y = g
l.q = g
assert l.p.t.r.q.o.txt == "k"