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

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

class C:
    def __init__(self, txt: str):
        self.q: B = None
        self.y: E = None
        self.z: B = None
        self.t: F = None
        self.p: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: E = None
        self.s: D = None
        self.x: E = None
        self.q: B = None
        self.z: C = None
        self.u: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: A = None
        self.z: F = None
        self.u: B = None
        self.x: D = None
        self.y: A = None
        self.txt = txt

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.q: B = None
        self.y: E = None
        self.z: B = None
        self.t: F = None
        self.p: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: E = None
        self.s: D = None
        self.x: E = None
        self.q: B = None
        self.z: C = None
        self.u: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: A = None
        self.z: F = None
        self.u: B = None
        self.x: D = None
        self.y: A = None
        self.txt = txt

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

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

f.u = d
f.p = k
l.q = d
l.r = n
l.p = k
d.q = l
d.z = l
d.p = l
d.y = n
d.t = k
a.y = n
a.x = n
a.u = n
a.s = g
a.q = l
a.z = d
n.q = f
n.y = f
n.z = k
n.u = l
n.x = g
k.s = n
k.u = n
g.y = n
g.x = n
g.u = n
g.s = a
g.q = l
g.z = d
assert a.q.p.s.q.p.u.txt == "n"