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

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

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

class D:
    def __init__(self, txt: str):
        self.v: E = None
        self.p: B = None
        self.u: F = None
        self.z: B = None
        self.y: C = None
        self.w: G = None
        self.x: E = None
        self.r: G = None
        self.txt = txt

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

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

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

class H:
    def __init__(self, txt: str):
        self.z: G = None
        self.s: E = None
        self.y: C = None
        self.v: E = None
        self.q: B = None
        self.x: A = None
        self.u: B = None
        self.w: A = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.v: E = None
        self.p: B = None
        self.u: F = None
        self.z: B = None
        self.y: C = None
        self.w: G = None
        self.x: E = None
        self.r: G = None
        self.txt = txt

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

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

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

class H:
    def __init__(self, txt: str):
        self.z: G = None
        self.s: E = None
        self.y: C = None
        self.v: E = None
        self.q: B = None
        self.x: A = None
        self.u: B = None
        self.w: A = None
        self.txt = txt

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

d.r = c
d.q = g
l.v = d
l.u = a
a.x = l
a.s = f
a.p = f
a.u = g
a.q = d
g.v = b
g.x = b
g.p = l
g.z = l
g.u = c
g.y = a
g.w = f
g.r = f
b.z = m
b.r = c
b.q = g
c.y = g
f.r = l
f.p = g
m.z = f
m.s = b
m.v = b
m.y = a
m.q = l
m.u = l
m.x = d
m.w = d
assert a.x.v.q.u.y.u.y.txt == "g"