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

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

class C:
    def __init__(self, txt: str):
        self.r: F = None
        self.p: D = None
        self.x: E = 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.w: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.x: B = None
        self.p: E = None
        self.q: B = None
        self.r: E = None
        self.txt = txt

k = A("k")
c = B("c")
h = C("h")
b = D("b")
f = E("f")
i = F("i")

k.o = i
k.x = i
k.p = i
c.v = h
c.q = i
c.x = k
h.r = i
h.p = b
h.x = f
b.o = i
f.w = k
i.x = c
i.q = c
i.p = f
i.r = f
assert b.o.x.q.txt == "
class A:
    def __init__(self, txt: str):
        self.o: F = None
        self.x: F = None
        self.p: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: F = None
        self.p: D = None
        self.x: E = 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.w: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.x: B = None
        self.p: E = None
        self.q: B = None
        self.r: E = None
        self.txt = txt

k = A("k")
c = B("c")
h = C("h")
b = D("b")
f = E("f")
i = F("i")

k.o = i
k.x = i
k.p = i
c.v = h
c.q = i
c.x = k
h.r = i
h.p = b
h.x = f
b.o = i
f.w = k
i.x = c
i.q = c
i.p = f
i.r = f
assert b.o.x.q.txt == "i"