class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: F = None
        self.x: B = None
        self.q: D = None
        self.y: F = None
        self.p: B = None
        self.w: D = None
        self.txt = txt

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

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

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

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

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

h = A("h")
e = B("e")
c = C("c")
b = D("b")
m = E("m")
k = F("k")
f = G("f")
i = G("i")
l = B("l")

h.q = c
e.s = k
e.y = k
e.x = l
e.p = l
e.q = b
e.w = b
c.r = h
b.s = h
b.q = m
b.u = m
m.o = h
m.t = e
m.p = c
k.r = e
k.u = b
f.r = i
f.o = i
f.y = m
i.r = f
i.o = f
i.y = m
l.s = k
l.y = k
l.x = e
l.p = e
l.q = b
l.w = b
assert i.o.y.o.q.r.q.r.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: F = None
        self.x: B = None
        self.q: D = None
        self.y: F = None
        self.p: B = None
        self.w: D = None
        self.txt = txt

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

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

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

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

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

h = A("h")
e = B("e")
c = C("c")
b = D("b")
m = E("m")
k = F("k")
f = G("f")
i = G("i")
l = B("l")

h.q = c
e.s = k
e.y = k
e.x = l
e.p = l
e.q = b
e.w = b
c.r = h
b.s = h
b.q = m
b.u = m
m.o = h
m.t = e
m.p = c
k.r = e
k.u = b
f.r = i
f.o = i
f.y = m
i.r = f
i.o = f
i.y = m
l.s = k
l.y = k
l.x = e
l.p = e
l.q = b
l.w = b
assert i.o.y.o.q.r.q.r.txt == "h"