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

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

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

class D:
    def __init__(self, txt: str):
        self.o: F = None
        self.txt = txt

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

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

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

n.p = k
k.o = d
k.s = d
k.p = i
k.t = a
d.u = j
d.q = j
d.p = c
e.o = c
i.y = d
i.z = d
c.p = i
c.z = b
j.p = k
a.p = k
b.o = c
assert j.p.s.p.p.z.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.o: F = None
        self.txt = txt

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

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

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

n.p = k
k.o = d
k.s = d
k.p = i
k.t = a
d.u = j
d.q = j
d.p = c
e.o = c
i.y = d
i.z = d
c.p = i
c.z = b
j.p = k
a.p = k
b.o = c
assert j.p.s.p.p.z.p.txt == "c"