class A:
    def __init__(self, txt: str):
        self.t: G = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.w: E = None
        self.o: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.z: G = None
        self.y: G = None
        self.u: A = None
        self.x: A = None
        self.s: A = None
        self.o: D = None
        self.v: G = None
        self.txt = txt

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

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.w: E = None
        self.o: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.z: G = None
        self.y: G = None
        self.u: A = None
        self.x: A = None
        self.s: A = None
        self.o: D = None
        self.v: G = None
        self.txt = txt

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

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

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

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