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

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

class C:
    def __init__(self, txt: str):
        self.t: A = None
        self.u: A = None
        self.y: D = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.w: E = None
        self.txt = txt

l = A("l")
j = B("j")
h = C("h")
c = D("c")
k = E("k")
d = F("d")
b = G("b")
m = H("m")
g = A("g")

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

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

class C:
    def __init__(self, txt: str):
        self.t: A = None
        self.u: A = None
        self.y: D = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.w: E = None
        self.txt = txt

l = A("l")
j = B("j")
h = C("h")
c = D("c")
k = E("k")
d = F("d")
b = G("b")
m = H("m")
g = A("g")

l.y = j
l.x = k
j.z = c
j.y = k
j.r = h
h.t = g
h.u = l
h.y = c
c.s = b
k.x = j
d.s = j
b.o = j
m.w = k
g.y = j
g.x = k
assert h.t.y.r.txt == "h"