class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: A = None
        self.p: F = None
        self.r: G = None
        self.z: B = None
        self.q: E = None
        self.w: D = None
        self.txt = txt

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

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.w: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: A = None
        self.p: F = None
        self.r: G = None
        self.z: B = None
        self.q: E = None
        self.w: D = None
        self.txt = txt

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

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

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

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

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

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