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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.q: B = None
        self.u: B = None
        self.w: B = None
        self.x: A = None
        self.txt = txt

h = A("h")
c = B("c")
m = C("m")
k = D("k")
a = E("a")
n = F("n")
j = D("j")
g = D("g")
l = B("l")
d = F("d")

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.q: B = None
        self.u: B = None
        self.w: B = None
        self.x: A = None
        self.txt = txt

h = A("h")
c = B("c")
m = C("m")
k = D("k")
a = E("a")
n = F("n")
j = D("j")
g = D("g")
l = B("l")
d = F("d")

h.t = m
h.r = g
c.v = a
c.z = a
c.p = a
c.s = g
m.r = j
m.o = c
m.x = h
k.w = g
k.u = m
a.x = m
n.q = c
n.u = c
n.w = c
n.x = h
j.w = k
j.u = m
g.w = k
g.u = m
l.v = a
l.z = a
l.p = a
l.s = j
d.q = l
d.w = l
d.u = c
d.x = h
assert h.r.w.u.x.r.txt == "g"