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

class B:
    def __init__(self, txt: str):
        self.r: F = None
        self.u: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.p: D = None
        self.z: A = None
        self.s: D = None
        self.w: C = None
        self.t: A = None
        self.r: B = None
        self.txt = txt

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

f = A("f")
e = B("e")
k = C("k")
c = D("c")
l = E("l")
n = F("n")

f.x = k
e.r = n
e.u = c
k.u = f
k.q = c
c.z = n
c.r = n
c.v = k
l.p = c
l.s = c
l.z = f
l.t = f
l.w = k
l.r = e
n.t = e
n.p = e
n.u = f
n.q = f
n.x = k
assert l.r.r.p.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: F = None
        self.u: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.p: D = None
        self.z: A = None
        self.s: D = None
        self.w: C = None
        self.t: A = None
        self.r: B = None
        self.txt = txt

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

f = A("f")
e = B("e")
k = C("k")
c = D("c")
l = E("l")
n = F("n")

f.x = k
e.r = n
e.u = c
k.u = f
k.q = c
c.z = n
c.r = n
c.v = k
l.p = c
l.s = c
l.z = f
l.t = f
l.w = k
l.r = e
n.t = e
n.p = e
n.u = f
n.q = f
n.x = k
assert l.r.r.p.txt == "e"