class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.r: C = None
        self.o: D = None
        self.w: E = None
        self.x: E = None
        self.v: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.v: F = None
        self.w: E = None
        self.z: B = None
        self.u: B = None
        self.q: A = None
        self.o: C = None
        self.txt = txt

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

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

b = A("b")
a = B("a")
k = C("k")
d = D("d")
g = E("g")
f = F("f")
l = C("l")

b.q = l
b.r = l
b.o = d
b.w = g
b.x = g
b.v = a
a.z = k
a.x = b
k.p = d
d.v = f
d.w = g
d.z = a
d.u = a
d.q = b
d.o = l
g.w = k
g.u = f
f.x = d
f.o = b
l.p = d
assert a.x.v.x.v.x.r.p.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.r: C = None
        self.o: D = None
        self.w: E = None
        self.x: E = None
        self.v: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.v: F = None
        self.w: E = None
        self.z: B = None
        self.u: B = None
        self.q: A = None
        self.o: C = None
        self.txt = txt

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

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

b = A("b")
a = B("a")
k = C("k")
d = D("d")
g = E("g")
f = F("f")
l = C("l")

b.q = l
b.r = l
b.o = d
b.w = g
b.x = g
b.v = a
a.z = k
a.x = b
k.p = d
d.v = f
d.w = g
d.z = a
d.u = a
d.q = b
d.o = l
g.w = k
g.u = f
f.x = d
f.o = b
l.p = d
assert a.x.v.x.v.x.r.p.txt == "d"