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

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

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

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

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

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

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

b.p = i
b.z = i
b.v = i
b.u = f
k.q = h
h.p = f
h.z = f
f.y = b
f.q = h
f.w = h
i.t = e
i.u = e
i.x = k
e.r = b
e.s = b
e.x = i
e.o = k
assert b.z.x.q.z.txt == "
class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.z: E = None
        self.v: E = None
        self.u: D = None
        self.txt = txt

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

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

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

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

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

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

b.p = i
b.z = i
b.v = i
b.u = f
k.q = h
h.p = f
h.z = f
f.y = b
f.q = h
f.w = h
i.t = e
i.u = e
i.x = k
e.r = b
e.s = b
e.x = i
e.o = k
assert b.z.x.q.z.txt == "f"