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

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: A = None
        self.x: B = None
        self.y: A = None
        self.q: C = None
        self.txt = txt

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

j.t = m
b.q = c
c.o = m
c.w = b
m.r = c
m.p = e
m.w = j
m.q = b
e.x = l
l.p = j
l.y = j
l.x = b
l.q = c
assert b.q.o.r.o.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: A = None
        self.x: B = None
        self.y: A = None
        self.q: C = None
        self.txt = txt

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

j.t = m
b.q = c
c.o = m
c.w = b
m.r = c
m.p = e
m.w = j
m.q = b
e.x = l
l.p = j
l.y = j
l.x = b
l.q = c
assert b.q.o.r.o.txt == "m"