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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

c.u = n
g.p = l
l.t = m
l.y = a
l.r = f
d.r = m
d.z = c
a.y = n
n.q = g
n.t = l
m.z = a
m.v = a
m.p = a
m.q = c
m.w = c
m.u = n
f.r = m
f.z = c
assert m.w.u.t.r.r.w.u.txt == "n"