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

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: B = None
        self.y: C = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.w: D = None
        self.y: A = None
        self.x: A = None
        self.o: C = None
        self.p: D = None
        self.v: F = None
        self.s: C = None
        self.txt = txt

b = A("b")
l = B("l")
k = C("k")
g = D("g")
a = E("a")
c = F("c")
e = G("e")
j = H("j")

b.r = l
b.w = g
b.s = c
l.u = c
l.o = k
k.q = g
k.r = l
k.o = a
g.z = b
g.u = k
g.v = c
g.o = l
g.s = a
a.p = l
a.y = k
c.o = k
e.r = b
e.w = c
j.w = g
j.p = g
j.y = b
j.x = b
j.o = k
j.s = k
j.v = c
assert k.o.p.o.q.u.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.w: D = None
        self.s: F = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: B = None
        self.y: C = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.w: D = None
        self.y: A = None
        self.x: A = None
        self.o: C = None
        self.p: D = None
        self.v: F = None
        self.s: C = None
        self.txt = txt

b = A("b")
l = B("l")
k = C("k")
g = D("g")
a = E("a")
c = F("c")
e = G("e")
j = H("j")

b.r = l
b.w = g
b.s = c
l.u = c
l.o = k
k.q = g
k.r = l
k.o = a
g.z = b
g.u = k
g.v = c
g.o = l
g.s = a
a.p = l
a.y = k
c.o = k
e.r = b
e.w = c
j.w = g
j.p = g
j.y = b
j.x = b
j.o = k
j.s = k
j.v = c
assert k.o.p.o.q.u.txt == "k"