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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.w: E = None
        self.o: C = None
        self.q: F = None
        self.s: F = None
        self.x: F = None
        self.txt = txt

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

c.q = k
c.p = b
c.o = b
c.r = f
c.x = i
c.w = i
i.s = a
i.w = c
a.r = c
b.v = a
k.z = n
k.y = a
k.v = b
f.w = k
f.o = a
f.q = n
f.s = n
f.x = n
n.w = k
n.o = a
n.q = f
n.s = f
n.x = f
assert f.o.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.p: D = None
        self.o: D = None
        self.r: F = None
        self.x: B = None
        self.w: B = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.w: E = None
        self.o: C = None
        self.q: F = None
        self.s: F = None
        self.x: F = None
        self.txt = txt

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

c.q = k
c.p = b
c.o = b
c.r = f
c.x = i
c.w = i
i.s = a
i.w = c
a.r = c
b.v = a
k.z = n
k.y = a
k.v = b
f.w = k
f.o = a
f.q = n
f.s = n
f.x = n
n.w = k
n.o = a
n.q = f
n.s = f
n.x = f
assert f.o.r.r.txt == "f"