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

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

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

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

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

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

f = A("f")
e = B("e")
b = C("b")
m = D("m")
k = E("k")
j = F("j")

f.p = j
f.u = j
f.x = b
f.q = m
e.s = k
b.y = m
m.o = b
m.u = j
m.v = k
k.v = m
j.t = b
j.x = b
j.r = b
j.v = f
assert k.v.o.y.v.v.o.txt == "
class A:
    def __init__(self, txt: str):
        self.p: F = None
        self.x: C = None
        self.u: F = None
        self.q: D = None
        self.txt = txt

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

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

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

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

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

f = A("f")
e = B("e")
b = C("b")
m = D("m")
k = E("k")
j = F("j")

f.p = j
f.u = j
f.x = b
f.q = m
e.s = k
b.y = m
m.o = b
m.u = j
m.v = k
k.v = m
j.t = b
j.x = b
j.r = b
j.v = f
assert k.v.o.y.v.v.o.txt == "b"