class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.w: D = None
        self.x: C = None
        self.q: B = None
        self.o: E = None
        self.t: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: A = None
        self.w: B = None
        self.s: F = None
        self.t: F = None
        self.v: C = None
        self.u: F = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.z: A = None
        self.x: A = None
        self.q: F = None
        self.txt = txt

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

m = A("m")
b = B("b")
h = C("h")
d = D("d")
a = E("a")
f = F("f")
n = B("n")

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

class B:
    def __init__(self, txt: str):
        self.q: A = None
        self.w: B = None
        self.s: F = None
        self.t: F = None
        self.v: C = None
        self.u: F = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.z: A = None
        self.x: A = None
        self.q: F = None
        self.txt = txt

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

m = A("m")
b = B("b")
h = C("h")
d = D("d")
a = E("a")
f = F("f")
n = B("n")

m.r = h
m.x = h
m.t = h
m.w = d
m.q = b
m.o = a
b.q = m
b.w = n
b.s = f
b.t = f
b.u = f
b.v = h
h.r = a
h.s = a
h.w = d
d.t = h
a.z = m
a.x = m
a.q = f
f.y = a
n.q = m
n.w = b
n.s = f
n.t = f
n.u = f
n.v = h
assert d.t.w.t.txt == "h"