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

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

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

class D:
    def __init__(self, txt: str):
        self.q: B = None
        self.p: E = None
        self.u: C = None
        self.v: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.q: B = None
        self.p: E = None
        self.u: C = None
        self.v: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

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

i.p = f
i.z = f
i.u = l
k.r = i
k.q = f
k.s = n
l.u = i
l.v = i
l.p = g
f.q = k
f.p = g
f.u = l
f.v = l
g.t = f
n.s = i
n.y = i
assert n.y.u.p.t.p.t.txt == "f"