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

class B:
    def __init__(self, txt: str):
        self.t: E = None
        self.txt = txt

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

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

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

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

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

h = A("h")
m = B("m")
d = C("d")
n = D("n")
g = E("g")
j = F("j")
c = G("c")

h.t = g
h.s = c
h.z = c
h.r = m
m.t = g
d.y = j
d.v = m
n.o = j
n.p = m
n.r = c
g.z = m
g.u = j
g.p = h
g.t = n
g.o = d
j.y = g
j.o = g
j.p = c
j.x = n
c.r = d
c.v = j
c.o = j
c.y = g
c.x = g
c.p = m
c.z = m
assert g.o.y.p.y.t.r.txt == "
class A:
    def __init__(self, txt: str):
        self.t: E = None
        self.s: G = None
        self.r: B = None
        self.z: G = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: E = None
        self.txt = txt

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

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

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

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

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

h = A("h")
m = B("m")
d = C("d")
n = D("n")
g = E("g")
j = F("j")
c = G("c")

h.t = g
h.s = c
h.z = c
h.r = m
m.t = g
d.y = j
d.v = m
n.o = j
n.p = m
n.r = c
g.z = m
g.u = j
g.p = h
g.t = n
g.o = d
j.y = g
j.o = g
j.p = c
j.x = n
c.r = d
c.v = j
c.o = j
c.y = g
c.x = g
c.p = m
c.z = m
assert g.o.y.p.y.t.r.txt == "c"