class A:
    def __init__(self, txt: str):
        self.w: F = None
        self.r: B = None
        self.u: E = None
        self.p: F = None
        self.s: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: A = None
        self.z: A = None
        self.s: D = None
        self.q: B = None
        self.r: F = None
        self.txt = txt

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

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

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

h.w = l
h.p = l
h.r = k
h.s = k
h.u = g
k.r = l
n.u = k
j.u = i
j.x = c
j.r = h
g.o = h
g.z = h
g.s = j
g.q = k
g.r = l
l.w = k
l.o = k
c.s = j
c.o = j
i.u = k
assert c.o.u.u.r.txt == "
class A:
    def __init__(self, txt: str):
        self.w: F = None
        self.r: B = None
        self.u: E = None
        self.p: F = None
        self.s: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: A = None
        self.z: A = None
        self.s: D = None
        self.q: B = None
        self.r: F = None
        self.txt = txt

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

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

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

h.w = l
h.p = l
h.r = k
h.s = k
h.u = g
k.r = l
n.u = k
j.u = i
j.x = c
j.r = h
g.o = h
g.z = h
g.s = j
g.q = k
g.r = l
l.w = k
l.o = k
c.s = j
c.o = j
i.u = k
assert c.o.u.u.r.txt == "l"