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

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

class C:
    def __init__(self, txt: str):
        self.u: B = None
        self.t: F = None
        self.txt = txt

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

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

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

m = A("m")
c = B("c")
h = C("h")
g = D("g")
e = E("e")
b = F("b")

m.t = c
m.v = h
c.t = m
c.q = h
c.y = g
h.u = c
h.t = b
g.s = b
g.p = b
g.y = h
e.v = m
e.u = c
b.p = m
b.w = g
b.v = c
assert c.t.t.q.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.v: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.u: B = None
        self.t: F = None
        self.txt = txt

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

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

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

m = A("m")
c = B("c")
h = C("h")
g = D("g")
e = E("e")
b = F("b")

m.t = c
m.v = h
c.t = m
c.q = h
c.y = g
h.u = c
h.t = b
g.s = b
g.p = b
g.y = h
e.v = m
e.u = c
b.p = m
b.w = g
b.v = c
assert c.t.t.q.txt == "h"