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

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

class C:
    def __init__(self, txt: str):
        self.q: A = None
        self.o: B = None
        self.t: F = None
        self.u: F = None
        self.y: B = None
        self.z: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: C = None
        self.q: F = None
        self.o: D = None
        self.p: A = None
        self.txt = txt

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

i = A("i")
n = B("n")
h = C("h")
j = D("j")
c = E("c")
f = F("f")

i.u = h
i.q = n
n.t = i
n.y = i
n.u = c
n.r = h
n.s = f
h.q = i
h.z = i
h.o = n
h.y = n
h.t = f
h.u = f
j.p = c
c.u = h
c.q = f
c.o = j
c.p = i
f.u = i
f.q = i
f.x = n
f.v = c
assert c.q.q.u.t.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.q: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: A = None
        self.o: B = None
        self.t: F = None
        self.u: F = None
        self.y: B = None
        self.z: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: C = None
        self.q: F = None
        self.o: D = None
        self.p: A = None
        self.txt = txt

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

i = A("i")
n = B("n")
h = C("h")
j = D("j")
c = E("c")
f = F("f")

i.u = h
i.q = n
n.t = i
n.y = i
n.u = c
n.r = h
n.s = f
h.q = i
h.z = i
h.o = n
h.y = n
h.t = f
h.u = f
j.p = c
c.u = h
c.q = f
c.o = j
c.p = i
f.u = i
f.q = i
f.x = n
f.v = c
assert c.q.q.u.t.txt == "f"