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

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

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

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

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

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

i = A("i")
k = B("k")
b = C("b")
n = D("n")
d = E("d")
g = F("g")

i.z = k
k.q = d
k.w = d
b.p = n
b.s = n
b.x = i
b.w = g
n.x = b
n.p = k
d.o = b
d.z = g
g.r = n
g.q = n
assert d.z.r.p.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

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

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

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

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

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

i = A("i")
k = B("k")
b = C("b")
n = D("n")
d = E("d")
g = F("g")

i.z = k
k.q = d
k.w = d
b.p = n
b.s = n
b.x = i
b.w = g
n.x = b
n.p = k
d.o = b
d.z = g
g.r = n
g.q = n
assert d.z.r.p.txt == "k"