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

class B:
    def __init__(self, txt: str):
        self.t: E = None
        self.p: D = None
        self.z: C = None
        self.x: E = None
        self.w: D = None
        self.q: C = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.t: D = None
        self.s: D = None
        self.y: B = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.t: E = None
        self.p: D = None
        self.z: C = None
        self.x: E = None
        self.w: D = None
        self.q: C = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.t: D = None
        self.s: D = None
        self.y: B = None
        self.txt = txt

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

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

d.r = a
d.u = j
d.x = n
a.t = c
a.p = j
a.w = j
a.z = i
a.x = k
a.q = n
i.q = c
j.o = k
j.r = k
j.z = l
j.x = l
j.p = a
k.t = j
k.s = j
k.y = a
l.o = a
b.q = k
c.t = j
c.s = j
c.y = a
n.q = k
assert l.o.q.q.s.o.txt == "k"