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

class B:
    def __init__(self, txt: str):
        self.x: G = None
        self.q: F = None
        self.v: G = None
        self.p: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: A = None
        self.u: B = None
        self.v: E = None
        self.z: A = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.x: C = None
        self.y: F = None
        self.txt = txt

h = A("h")
i = B("i")
c = C("c")
b = D("b")
e = E("e")
a = F("a")
n = G("n")
g = G("g")
l = A("l")

h.p = a
h.s = a
i.x = n
i.v = n
i.q = a
i.p = e
c.o = h
c.z = h
c.u = i
c.v = e
b.v = g
b.w = i
b.o = c
e.u = c
a.u = e
a.w = n
a.x = c
n.x = c
n.y = a
g.x = c
g.y = a
l.p = a
l.s = a
assert i.x.y.w.x.u.q.x.v.u.txt == "
class A:
    def __init__(self, txt: str):
        self.p: F = None
        self.s: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: G = None
        self.q: F = None
        self.v: G = None
        self.p: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: A = None
        self.u: B = None
        self.v: E = None
        self.z: A = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.x: C = None
        self.y: F = None
        self.txt = txt

h = A("h")
i = B("i")
c = C("c")
b = D("b")
e = E("e")
a = F("a")
n = G("n")
g = G("g")
l = A("l")

h.p = a
h.s = a
i.x = n
i.v = n
i.q = a
i.p = e
c.o = h
c.z = h
c.u = i
c.v = e
b.v = g
b.w = i
b.o = c
e.u = c
a.u = e
a.w = n
a.x = c
n.x = c
n.y = a
g.x = c
g.y = a
l.p = a
l.s = a
assert i.x.y.w.x.u.q.x.v.u.txt == "c"