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

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: C = None
        self.v: C = None
        self.u: D = None
        self.txt = txt

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

n = A("n")
i = B("i")
f = C("f")
c = D("c")
m = E("m")
l = F("l")
a = E("a")
d = B("d")

n.t = a
i.u = l
i.x = c
i.p = c
i.z = d
i.y = n
f.p = c
f.v = i
c.t = n
m.q = f
m.v = f
m.u = c
l.t = i
a.q = f
a.v = f
a.u = c
d.u = l
d.x = c
d.p = c
d.z = i
d.y = n
assert i.z.z.p.txt == "
class A:
    def __init__(self, txt: str):
        self.t: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: C = None
        self.v: C = None
        self.u: D = None
        self.txt = txt

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

n = A("n")
i = B("i")
f = C("f")
c = D("c")
m = E("m")
l = F("l")
a = E("a")
d = B("d")

n.t = a
i.u = l
i.x = c
i.p = c
i.z = d
i.y = n
f.p = c
f.v = i
c.t = n
m.q = f
m.v = f
m.u = c
l.t = i
a.q = f
a.v = f
a.u = c
d.u = l
d.x = c
d.p = c
d.z = i
d.y = n
assert i.z.z.p.txt == "c"