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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.s: D = None
        self.z: A = None
        self.txt = txt

l = A("l")
g = B("g")
f = C("f")
i = D("i")
c = E("c")
a = F("a")
k = E("k")

l.z = f
g.u = i
g.w = i
g.t = l
g.p = k
g.y = c
f.y = i
f.p = i
i.w = a
c.v = k
c.p = k
a.s = i
a.z = l
k.v = c
k.p = c
assert k.p.v.p.p.v.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.s: D = None
        self.z: A = None
        self.txt = txt

l = A("l")
g = B("g")
f = C("f")
i = D("i")
c = E("c")
a = F("a")
k = E("k")

l.z = f
g.u = i
g.w = i
g.t = l
g.p = k
g.y = c
f.y = i
f.p = i
i.w = a
c.v = k
c.p = k
a.s = i
a.z = l
k.v = c
k.p = c
assert k.p.v.p.p.v.v.v.txt == "c"