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

class B:
    def __init__(self, txt: str):
        self.p: D = None
        self.t: C = None
        self.x: A = None
        self.q: E = None
        self.w: E = None
        self.y: D = None
        self.txt = txt

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

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.p: D = None
        self.t: C = None
        self.x: A = None
        self.q: E = None
        self.w: E = None
        self.y: D = None
        self.txt = txt

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

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

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

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

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

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