class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.r: B = None
        self.o: F = None
        self.y: E = None
        self.s: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: A = None
        self.txt = txt

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

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

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

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

d = A("d")
m = B("m")
n = C("n")
a = D("a")
g = E("g")
c = F("c")

d.t = n
d.s = n
d.r = m
d.o = c
d.y = g
m.u = d
n.q = d
a.o = d
g.u = d
c.y = n
c.x = n
assert m.u.o.x.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.r: B = None
        self.o: F = None
        self.y: E = None
        self.s: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: A = None
        self.txt = txt

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

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

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

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

d = A("d")
m = B("m")
n = C("n")
a = D("a")
g = E("g")
c = F("c")

d.t = n
d.s = n
d.r = m
d.o = c
d.y = g
m.u = d
n.q = d
a.o = d
g.u = d
c.y = n
c.x = n
assert m.u.o.x.txt == "n"