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

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: B = None
        self.x: C = None
        self.q: F = None
        self.z: D = None
        self.v: D = None
        self.s: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.t: D = None
        self.z: D = None
        self.u: A = None
        self.r: B = None
        self.x: D = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: B = None
        self.x: C = None
        self.q: F = None
        self.z: D = None
        self.v: D = None
        self.s: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.t: D = None
        self.z: D = None
        self.u: A = None
        self.r: B = None
        self.x: D = None
        self.txt = txt

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

n.t = h
n.y = f
h.q = f
m.q = h
b.u = n
f.r = h
f.s = h
f.x = m
f.q = i
f.z = b
f.v = b
i.t = b
i.z = b
i.x = b
i.u = n
i.r = h
assert f.s.q.x.txt == "m"