class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.r: B = None
        self.v: C = None
        self.y: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: A = None
        self.x: C = None
        self.txt = txt

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

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: A = None
        self.x: C = None
        self.txt = txt

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

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

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