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

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

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

class D:
    def __init__(self, txt: str):
        self.u: E = None
        self.s: F = None
        self.txt = txt

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

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

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

n = A("n")
a = B("a")
j = C("j")
h = D("h")
c = E("c")
b = F("b")
l = G("l")

n.r = b
n.u = h
a.o = b
a.u = b
a.s = l
a.z = n
a.t = j
j.r = h
j.x = h
h.u = c
h.s = b
c.t = h
c.y = n
c.r = j
c.z = l
c.s = b
b.z = h
l.q = b
l.u = c
assert l.q.z.u.txt == "
class A:
    def __init__(self, txt: str):
        self.r: F = None
        self.u: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.u: E = None
        self.s: F = None
        self.txt = txt

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

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

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

n = A("n")
a = B("a")
j = C("j")
h = D("h")
c = E("c")
b = F("b")
l = G("l")

n.r = b
n.u = h
a.o = b
a.u = b
a.s = l
a.z = n
a.t = j
j.r = h
j.x = h
h.u = c
h.s = b
c.t = h
c.y = n
c.r = j
c.z = l
c.s = b
b.z = h
l.q = b
l.u = c
assert l.q.z.u.txt == "c"