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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.p: A = None
        self.txt = txt

k = A("k")
b = B("b")
l = C("l")
m = D("m")
n = E("n")
f = F("f")

k.o = m
k.y = b
b.x = f
b.t = f
b.q = m
l.q = b
l.y = k
l.p = n
l.u = n
l.w = m
m.o = f
n.s = l
n.q = m
n.p = m
f.p = k
assert k.y.q.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.y: B = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.p: A = None
        self.txt = txt

k = A("k")
b = B("b")
l = C("l")
m = D("m")
n = E("n")
f = F("f")

k.o = m
k.y = b
b.x = f
b.t = f
b.q = m
l.q = b
l.y = k
l.p = n
l.u = n
l.w = m
m.o = f
n.s = l
n.q = m
n.p = m
f.p = k
assert k.y.q.o.txt == "f"