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

class B:
    def __init__(self, txt: str):
        self.x: H = None
        self.o: H = None
        self.v: G = None
        self.z: G = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.o: B = None
        self.r: F = None
        self.z: B = None
        self.q: F = None
        self.x: H = None
        self.w: F = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.o: F = None
        self.r: B = None
        self.q: F = None
        self.w: B = None
        self.s: C = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.q: C = None
        self.z: E = None
        self.o: E = None
        self.v: B = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.x: H = None
        self.o: H = None
        self.v: G = None
        self.z: G = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.o: B = None
        self.r: F = None
        self.z: B = None
        self.q: F = None
        self.x: H = None
        self.w: F = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.o: F = None
        self.r: B = None
        self.q: F = None
        self.w: B = None
        self.s: C = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.q: C = None
        self.z: E = None
        self.o: E = None
        self.v: B = None
        self.txt = txt

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

g.t = d
l.x = n
l.o = n
l.v = d
l.z = d
k.r = b
m.o = l
m.z = l
m.r = b
m.q = b
m.w = b
m.x = n
c.p = m
b.t = m
d.o = b
d.q = b
d.r = l
d.w = l
d.s = k
n.q = k
n.z = c
n.o = c
n.v = l
e.t = d
assert b.t.o.z.o.t.o.o.o.p.txt == "m"