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

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

class C:
    def __init__(self, txt: str):
        self.u: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: B = None
        self.t: A = None
        self.s: E = None
        self.o: E = None
        self.q: F = None
        self.r: B = None
        self.txt = txt

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

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

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

c.p = m
a.t = m
a.v = m
a.s = m
a.o = m
a.r = d
a.z = j
d.u = i
m.p = a
m.r = a
m.t = c
m.s = j
m.o = j
m.q = i
l.t = a
l.z = m
l.w = d
i.r = c
i.v = c
j.t = a
j.z = m
j.w = d
n.t = a
n.z = m
n.w = d
assert d.u.v.p.q.r.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.u: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: B = None
        self.t: A = None
        self.s: E = None
        self.o: E = None
        self.q: F = None
        self.r: B = None
        self.txt = txt

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

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

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

c.p = m
a.t = m
a.v = m
a.s = m
a.o = m
a.r = d
a.z = j
d.u = i
m.p = a
m.r = a
m.t = c
m.s = j
m.o = j
m.q = i
l.t = a
l.z = m
l.w = d
i.r = c
i.v = c
j.t = a
j.z = m
j.w = d
n.t = a
n.z = m
n.w = d
assert d.u.v.p.q.r.p.txt == "m"