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

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

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

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

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

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

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

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

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

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

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

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

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

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

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