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

class B:
    def __init__(self, txt: str):
        self.o: E = None
        self.z: A = None
        self.s: A = None
        self.y: D = None
        self.r: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.w: D = None
        self.q: D = None
        self.txt = txt

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

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

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

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

f.t = e
i.o = n
i.z = f
i.s = f
i.r = f
i.y = c
a.x = c
a.w = c
a.q = c
c.y = f
c.s = f
c.q = a
c.z = i
c.x = j
n.y = j
n.z = c
e.p = f
e.x = f
e.r = i
e.s = i
e.z = c
j.y = n
j.z = c
assert a.x.y.t.r.y.x.y.txt == "
class A:
    def __init__(self, txt: str):
        self.t: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: E = None
        self.z: A = None
        self.s: A = None
        self.y: D = None
        self.r: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.w: D = None
        self.q: D = None
        self.txt = txt

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

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

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

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

f.t = e
i.o = n
i.z = f
i.s = f
i.r = f
i.y = c
a.x = c
a.w = c
a.q = c
c.y = f
c.s = f
c.q = a
c.z = i
c.x = j
n.y = j
n.z = c
e.p = f
e.x = f
e.r = i
e.s = i
e.z = c
j.y = n
j.z = c
assert a.x.y.t.r.y.x.y.txt == "n"