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

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: D = None
        self.r: A = None
        self.t: A = None
        self.u: A = None
        self.s: B = None
        self.x: B = None
        self.txt = txt

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

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: D = None
        self.r: A = None
        self.t: A = None
        self.u: A = None
        self.s: B = None
        self.x: B = None
        self.txt = txt

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

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

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