class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.u: B = None
        self.y: D = None
        self.o: G = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: G = None
        self.txt = txt

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

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

n = A("n")
k = B("k")
c = C("c")
d = D("d")
l = E("l")
j = F("j")
m = G("m")
h = B("h")
b = D("b")
e = B("e")

n.r = c
n.u = k
n.y = d
n.o = m
k.z = n
k.u = l
k.t = j
c.o = n
d.s = c
l.x = m
j.q = m
m.y = d
m.z = b
m.w = n
h.z = n
h.u = l
h.t = j
b.s = c
e.z = n
e.u = l
e.t = j
assert k.u.x.z.s.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.u: B = None
        self.y: D = None
        self.o: G = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: G = None
        self.txt = txt

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

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

n = A("n")
k = B("k")
c = C("c")
d = D("d")
l = E("l")
j = F("j")
m = G("m")
h = B("h")
b = D("b")
e = B("e")

n.r = c
n.u = k
n.y = d
n.o = m
k.z = n
k.u = l
k.t = j
c.o = n
d.s = c
l.x = m
j.q = m
m.y = d
m.z = b
m.w = n
h.z = n
h.u = l
h.t = j
b.s = c
e.z = n
e.u = l
e.t = j
assert k.u.x.z.s.txt == "c"