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

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

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

class D:
    def __init__(self, txt: str):
        self.p: G = None
        self.x: B = None
        self.z: G = None
        self.o: G = None
        self.t: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: H = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: C = None
        self.y: A = None
        self.o: A = None
        self.u: G = None
        self.p: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

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

n = A("n")
f = B("f")
d = C("d")
j = D("j")
k = E("k")
b = F("b")
g = G("g")
m = H("m")
c = D("c")
l = B("l")

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

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

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

class D:
    def __init__(self, txt: str):
        self.p: G = None
        self.x: B = None
        self.z: G = None
        self.o: G = None
        self.t: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: H = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: C = None
        self.y: A = None
        self.o: A = None
        self.u: G = None
        self.p: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

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

n = A("n")
f = B("f")
d = C("d")
j = D("j")
k = E("k")
b = F("b")
g = G("g")
m = H("m")
c = D("c")
l = B("l")

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