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

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: A = None
        self.txt = txt

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

l = A("l")
j = B("j")
m = C("m")
d = D("d")
c = E("c")
e = F("e")

l.r = m
l.v = m
l.x = j
l.q = j
j.t = e
m.p = d
d.t = m
d.u = l
d.r = l
d.q = c
c.v = l
e.t = l
assert m.p.q.v.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.v: C = None
        self.x: B = None
        self.q: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: A = None
        self.txt = txt

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

l = A("l")
j = B("j")
m = C("m")
d = D("d")
c = E("c")
e = F("e")

l.r = m
l.v = m
l.x = j
l.q = j
j.t = e
m.p = d
d.t = m
d.u = l
d.r = l
d.q = c
c.v = l
e.t = l
assert m.p.q.v.txt == "l"