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

class B:
    def __init__(self, txt: str):
        self.y: F = None
        self.v: D = None
        self.txt = txt

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

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.y: F = None
        self.v: D = None
        self.txt = txt

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

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

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

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

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

b.y = n
b.q = a
b.w = a
b.s = d
b.v = m
m.y = g
m.v = a
n.y = a
n.o = a
a.t = b
d.y = m
g.s = d
g.u = d
c.s = d
c.u = d
assert a.t.s.y.txt == "m"