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

class B:
    def __init__(self, txt: str):
        self.w: A = None
        self.z: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.p: F = None
        self.y: A = None
        self.t: C = None
        self.r: E = None
        self.txt = txt

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

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

n = A("n")
e = B("e")
j = C("j")
f = D("f")
l = E("l")
d = F("d")

n.q = e
n.z = e
e.w = n
e.z = l
j.x = f
f.p = d
f.y = n
f.t = j
f.r = l
l.t = n
l.q = n
l.u = f
l.z = j
l.x = j
d.w = f
d.z = e
d.p = e
d.o = l
assert d.o.x.x.t.x.y.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.z: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: A = None
        self.z: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.p: F = None
        self.y: A = None
        self.t: C = None
        self.r: E = None
        self.txt = txt

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

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

n = A("n")
e = B("e")
j = C("j")
f = D("f")
l = E("l")
d = F("d")

n.q = e
n.z = e
e.w = n
e.z = l
j.x = f
f.p = d
f.y = n
f.t = j
f.r = l
l.t = n
l.q = n
l.u = f
l.z = j
l.x = j
d.w = f
d.z = e
d.p = e
d.o = l
assert d.o.x.x.t.x.y.txt == "n"