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

class B:
    def __init__(self, txt: str):
        self.u: G = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.t: D = None
        self.y: A = None
        self.s: G = None
        self.v: C = None
        self.u: F = None
        self.z: B = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.q: F = None
        self.s: D = None
        self.t: E = None
        self.o: C = None
        self.txt = txt

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

b.r = g
k.u = n
d.v = k
d.y = k
f.q = g
f.r = d
f.t = n
h.t = f
h.y = b
h.s = n
h.v = d
h.u = g
h.z = k
g.w = k
g.v = k
g.u = h
g.q = f
n.q = g
n.s = f
n.t = h
n.o = d
c.r = g
assert c.r.v.u.txt == "
class A:
    def __init__(self, txt: str):
        self.r: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: G = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.t: D = None
        self.y: A = None
        self.s: G = None
        self.v: C = None
        self.u: F = None
        self.z: B = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.q: F = None
        self.s: D = None
        self.t: E = None
        self.o: C = None
        self.txt = txt

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

b.r = g
k.u = n
d.v = k
d.y = k
f.q = g
f.r = d
f.t = n
h.t = f
h.y = b
h.s = n
h.v = d
h.u = g
h.z = k
g.w = k
g.v = k
g.u = h
g.q = f
n.q = g
n.s = f
n.t = h
n.o = d
c.r = g
assert c.r.v.u.txt == "n"