class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.r: E = None
        self.s: B = None
        self.v: D = None
        self.w: C = None
        self.o: H = None
        self.z: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: G = None
        self.q: D = None
        self.txt = txt

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

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

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

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

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

l = A("l")
f = B("f")
n = C("n")
m = D("m")
a = E("a")
c = F("c")
g = G("g")
i = H("i")

l.y = n
l.w = n
l.z = n
l.r = a
l.s = f
l.v = m
l.o = i
f.u = g
f.q = g
n.v = g
n.q = m
m.p = c
a.o = g
c.p = a
c.o = g
g.t = m
i.t = m
i.p = f
i.x = g
assert n.q.p.o.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.r: E = None
        self.s: B = None
        self.v: D = None
        self.w: C = None
        self.o: H = None
        self.z: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: G = None
        self.q: D = None
        self.txt = txt

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

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

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

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

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

l = A("l")
f = B("f")
n = C("n")
m = D("m")
a = E("a")
c = F("c")
g = G("g")
i = H("i")

l.y = n
l.w = n
l.z = n
l.r = a
l.s = f
l.v = m
l.o = i
f.u = g
f.q = g
n.v = g
n.q = m
m.p = c
a.o = g
c.p = a
c.o = g
g.t = m
i.t = m
i.p = f
i.x = g
assert n.q.p.o.txt == "g"