class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.o: B = None
        self.v: F = None
        self.p: E = None
        self.z: D = None
        self.x: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.w: B = None
        self.s: B = None
        self.x: F = None
        self.txt = txt

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

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

a = A("a")
k = B("k")
j = C("j")
m = D("m")
g = E("g")
c = F("c")

a.r = k
a.o = k
a.v = c
a.p = g
a.z = m
a.x = m
k.o = m
k.p = m
j.z = g
j.y = k
j.o = a
m.w = k
m.s = k
m.x = c
g.v = k
c.r = k
c.s = k
c.u = a
assert a.v.u.p.v.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.o: B = None
        self.v: F = None
        self.p: E = None
        self.z: D = None
        self.x: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.w: B = None
        self.s: B = None
        self.x: F = None
        self.txt = txt

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

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

a = A("a")
k = B("k")
j = C("j")
m = D("m")
g = E("g")
c = F("c")

a.r = k
a.o = k
a.v = c
a.p = g
a.z = m
a.x = m
k.o = m
k.p = m
j.z = g
j.y = k
j.o = a
m.w = k
m.s = k
m.x = c
g.v = k
c.r = k
c.s = k
c.u = a
assert a.v.u.p.v.txt == "k"