class A:
    def __init__(self, txt: str):
        self.v: A = None
        self.y: B = None
        self.w: C = None
        self.q: D = None
        self.txt = txt

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

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

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

h = A("h")
j = B("j")
i = C("i")
k = D("k")
m = A("m")
c = D("c")
e = A("e")
g = B("g")

h.v = e
h.y = g
h.w = i
h.q = c
j.t = g
j.r = g
i.w = e
i.t = c
i.x = k
k.q = g
k.p = m
k.u = h
m.v = h
m.y = j
m.w = i
m.q = c
c.q = j
c.p = m
c.u = e
e.v = h
e.y = j
e.w = i
e.q = k
g.t = j
g.r = j
assert e.y.r.r.t.txt == "
class A:
    def __init__(self, txt: str):
        self.v: A = None
        self.y: B = None
        self.w: C = None
        self.q: D = None
        self.txt = txt

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

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

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

h = A("h")
j = B("j")
i = C("i")
k = D("k")
m = A("m")
c = D("c")
e = A("e")
g = B("g")

h.v = e
h.y = g
h.w = i
h.q = c
j.t = g
j.r = g
i.w = e
i.t = c
i.x = k
k.q = g
k.p = m
k.u = h
m.v = h
m.y = j
m.w = i
m.q = c
c.q = j
c.p = m
c.u = e
e.v = h
e.y = j
e.w = i
e.q = k
g.t = j
g.r = j
assert e.y.r.r.t.txt == "g"