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

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

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

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

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

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

k = A("k")
c = B("c")
f = C("f")
j = D("j")
n = E("n")
b = F("b")

k.p = j
c.y = n
c.p = b
f.v = c
j.q = k
j.t = k
j.o = k
j.u = f
j.p = f
n.q = b
n.y = k
n.w = k
n.z = j
n.x = j
n.r = f
b.p = f
assert n.r.v.p.p.v.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.txt = txt

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

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

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

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

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

k = A("k")
c = B("c")
f = C("f")
j = D("j")
n = E("n")
b = F("b")

k.p = j
c.y = n
c.p = b
f.v = c
j.q = k
j.t = k
j.o = k
j.u = f
j.p = f
n.q = b
n.y = k
n.w = k
n.z = j
n.x = j
n.r = f
b.p = f
assert n.r.v.p.p.v.txt == "c"