class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.z: B = None
        self.p: E = None
        self.r: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.u: F = None
        self.r: E = None
        self.p: A = None
        self.s: E = None
        self.x: G = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.z: D = None
        self.o: F = None
        self.u: B = None
        self.x: D = None
        self.t: B = None
        self.r: A = None
        self.w: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.t: E = None
        self.u: E = None
        self.r: G = None
        self.txt = txt

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

h = A("h")
d = B("d")
l = C("l")
m = D("m")
g = E("g")
k = F("k")
a = G("a")

h.t = m
h.r = m
h.z = d
h.p = g
d.q = g
d.y = g
d.z = g
l.u = k
l.r = g
l.s = g
l.p = h
l.x = a
m.p = g
g.z = m
g.x = m
g.o = k
g.u = d
g.t = d
g.r = h
g.w = h
k.t = g
k.u = g
k.r = a
a.v = m
assert l.u.r.v.p.u.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.z: B = None
        self.p: E = None
        self.r: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.u: F = None
        self.r: E = None
        self.p: A = None
        self.s: E = None
        self.x: G = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.z: D = None
        self.o: F = None
        self.u: B = None
        self.x: D = None
        self.t: B = None
        self.r: A = None
        self.w: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.t: E = None
        self.u: E = None
        self.r: G = None
        self.txt = txt

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

h = A("h")
d = B("d")
l = C("l")
m = D("m")
g = E("g")
k = F("k")
a = G("a")

h.t = m
h.r = m
h.z = d
h.p = g
d.q = g
d.y = g
d.z = g
l.u = k
l.r = g
l.s = g
l.p = h
l.x = a
m.p = g
g.z = m
g.x = m
g.o = k
g.u = d
g.t = d
g.r = h
g.w = h
k.t = g
k.u = g
k.r = a
a.v = m
assert l.u.r.v.p.u.txt == "d"