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

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

class C:
    def __init__(self, txt: str):
        self.o: A = None
        self.txt = txt

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

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

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

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

c.r = b
c.x = l
c.w = l
i.t = g
b.o = c
l.o = c
l.q = b
g.x = i
e.w = c
e.r = c
e.v = i
e.z = b
e.p = g
k.w = c
k.r = c
k.v = i
k.z = b
k.p = g
assert c.w.o.w.o.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.x: D = None
        self.w: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.o: A = None
        self.txt = txt

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

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

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

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

c.r = b
c.x = l
c.w = l
i.t = g
b.o = c
l.o = c
l.q = b
g.x = i
e.w = c
e.r = c
e.v = i
e.z = b
e.p = g
k.w = c
k.r = c
k.v = i
k.z = b
k.p = g
assert c.w.o.w.o.txt == "c"