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

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: A = None
        self.s: D = None
        self.u: F = None
        self.p: A = None
        self.y: D = None
        self.txt = txt

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

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

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: A = None
        self.s: D = None
        self.u: F = None
        self.p: A = None
        self.y: D = None
        self.txt = txt

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

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

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

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