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

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

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

class D:
    def __init__(self, txt: str):
        self.y: A = None
        self.w: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: D = None
        self.r: D = None
        self.w: B = None
        self.v: B = None
        self.t: D = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.t: F = None
        self.y: C = None
        self.s: E = None
        self.w: F = None
        self.txt = txt

n = A("n")
f = B("f")
i = C("i")
h = D("h")
k = E("k")
c = F("c")
l = G("l")
m = G("m")

n.r = c
f.r = h
i.t = k
i.p = c
i.s = c
i.v = f
i.z = f
i.o = n
i.q = n
h.y = n
h.w = i
k.o = h
k.r = h
k.t = h
k.w = f
k.v = f
c.x = n
l.t = c
l.w = c
l.y = i
l.s = k
m.t = c
m.w = c
m.y = i
m.s = k
assert k.o.y.r.x.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: F = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.y: A = None
        self.w: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: D = None
        self.r: D = None
        self.w: B = None
        self.v: B = None
        self.t: D = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.t: F = None
        self.y: C = None
        self.s: E = None
        self.w: F = None
        self.txt = txt

n = A("n")
f = B("f")
i = C("i")
h = D("h")
k = E("k")
c = F("c")
l = G("l")
m = G("m")

n.r = c
f.r = h
i.t = k
i.p = c
i.s = c
i.v = f
i.z = f
i.o = n
i.q = n
h.y = n
h.w = i
k.o = h
k.r = h
k.t = h
k.w = f
k.v = f
c.x = n
l.t = c
l.w = c
l.y = i
l.s = k
m.t = c
m.w = c
m.y = i
m.s = k
assert k.o.y.r.x.r.txt == "c"