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

class B:
    def __init__(self, txt: str):
        self.q: C = None
        self.r: D = None
        self.y: E = None
        self.s: A = None
        self.x: A = None
        self.p: D = 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.q: A = None
        self.u: F = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.q: C = None
        self.r: D = None
        self.y: E = None
        self.s: A = None
        self.x: A = None
        self.p: D = 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.q: A = None
        self.u: F = None
        self.txt = txt

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

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

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

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

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