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

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: D = None
        self.txt = txt

c = A("c")
e = B("e")
f = C("f")
b = D("b")
n = E("n")

c.q = n
c.o = b
e.o = n
e.p = b
e.w = f
f.q = c
f.t = c
f.v = b
b.q = f
b.r = f
b.w = f
n.o = b
assert c.o.r.t.o.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.o: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: D = None
        self.txt = txt

c = A("c")
e = B("e")
f = C("f")
b = D("b")
n = E("n")

c.q = n
c.o = b
e.o = n
e.p = b
e.w = f
f.q = c
f.t = c
f.v = b
b.q = f
b.r = f
b.w = f
n.o = b
assert c.o.r.t.o.txt == "b"