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

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

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

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

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

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

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

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

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

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

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

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

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

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

m.o = j
j.o = a
a.z = k
a.x = l
a.y = d
a.s = d
a.o = m
a.u = f
d.s = l
d.u = l
d.r = m
c.r = a
c.t = f
c.y = j
c.q = j
n.u = k
f.r = a
f.t = c
f.y = j
f.q = j
k.o = j
l.s = d
l.u = d
l.r = m
assert j.o.x.r.txt == "m"