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

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

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

class D:
    def __init__(self, txt: str):
        self.t: B = None
        self.s: B = None
        self.o: G = None
        self.x: F = None
        self.txt = txt

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

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

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

l = A("l")
b = B("b")
j = C("j")
c = D("c")
a = E("a")
h = F("h")
i = G("i")
e = B("e")
k = E("k")
d = D("d")

l.p = i
l.r = h
l.s = k
b.s = e
b.o = c
j.o = l
c.t = e
c.s = b
c.o = i
c.x = h
a.u = l
a.y = h
h.u = i
i.u = b
e.s = b
e.o = c
k.u = l
k.y = h
d.t = b
d.s = b
d.o = i
d.x = h
assert l.p.u.s.s.o.s.s.o.txt == "
class A:
    def __init__(self, txt: str):
        self.p: G = None
        self.r: F = None
        self.s: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.t: B = None
        self.s: B = None
        self.o: G = None
        self.x: F = None
        self.txt = txt

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

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

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

l = A("l")
b = B("b")
j = C("j")
c = D("c")
a = E("a")
h = F("h")
i = G("i")
e = B("e")
k = E("k")
d = D("d")

l.p = i
l.r = h
l.s = k
b.s = e
b.o = c
j.o = l
c.t = e
c.s = b
c.o = i
c.x = h
a.u = l
a.y = h
h.u = i
i.u = b
e.s = b
e.o = c
k.u = l
k.y = h
d.t = b
d.s = b
d.o = i
d.x = h
assert l.p.u.s.s.o.s.s.o.txt == "c"