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

class B:
    def __init__(self, txt: str):
        self.s: E = None
        self.q: G = None
        self.z: G = None
        self.v: B = None
        self.p: F = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.o: E = None
        self.u: A = None
        self.r: E = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.v: A = None
        self.y: F = None
        self.txt = txt

l = A("l")
i = B("i")
d = C("d")
n = D("n")
j = E("j")
k = F("k")
f = G("f")
e = B("e")

l.p = k
i.s = j
i.q = f
i.z = f
i.v = e
i.p = k
d.t = l
n.o = j
n.r = j
n.u = l
j.u = k
j.y = d
k.t = i
k.x = f
f.v = l
f.y = k
e.s = j
e.q = f
e.z = f
e.v = i
e.p = k
assert i.p.t.v.z.txt == "
class A:
    def __init__(self, txt: str):
        self.p: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: E = None
        self.q: G = None
        self.z: G = None
        self.v: B = None
        self.p: F = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.o: E = None
        self.u: A = None
        self.r: E = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.v: A = None
        self.y: F = None
        self.txt = txt

l = A("l")
i = B("i")
d = C("d")
n = D("n")
j = E("j")
k = F("k")
f = G("f")
e = B("e")

l.p = k
i.s = j
i.q = f
i.z = f
i.v = e
i.p = k
d.t = l
n.o = j
n.r = j
n.u = l
j.u = k
j.y = d
k.t = i
k.x = f
f.v = l
f.y = k
e.s = j
e.q = f
e.z = f
e.v = i
e.p = k
assert i.p.t.v.z.txt == "f"