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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.z: D = None
        self.p: C = None
        self.x: E = None
        self.r: D = None
        self.q: B = None
        self.w: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.r: A = None
        self.y: A = None
        self.o: E = None
        self.txt = txt

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

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.z: D = None
        self.p: C = None
        self.x: E = None
        self.r: D = None
        self.q: B = None
        self.w: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.r: A = None
        self.y: A = None
        self.o: E = None
        self.txt = txt

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

b.s = n
h.r = b
h.p = d
d.y = g
d.r = h
n.v = h
g.y = b
g.r = c
g.t = d
c.z = n
c.r = n
c.p = m
c.x = g
c.q = h
c.w = b
a.r = b
a.y = b
a.o = g
m.y = g
m.r = h
assert a.y.s.v.p.r.txt == "h"