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

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

class C:
    def __init__(self, txt: str):
        self.w: B = None
        self.z: A = None
        self.y: B = None
        self.r: F = None
        self.p: A = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.p: E = None
        self.u: D = None
        self.x: E = None
        self.o: E = None
        self.r: A = None
        self.txt = txt

c = A("c")
f = B("f")
g = C("g")
l = D("l")
b = E("b")
e = F("e")

c.r = b
f.q = e
g.w = f
g.y = f
g.z = c
g.p = c
g.r = e
l.o = f
b.z = f
e.p = b
e.x = b
e.o = b
e.u = l
e.r = c
assert b.z.q.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.w: B = None
        self.z: A = None
        self.y: B = None
        self.r: F = None
        self.p: A = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.p: E = None
        self.u: D = None
        self.x: E = None
        self.o: E = None
        self.r: A = None
        self.txt = txt

c = A("c")
f = B("f")
g = C("g")
l = D("l")
b = E("b")
e = F("e")

c.r = b
f.q = e
g.w = f
g.y = f
g.z = c
g.p = c
g.r = e
l.o = f
b.z = f
e.p = b
e.x = b
e.o = b
e.u = l
e.r = c
assert b.z.q.r.r.txt == "b"