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

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: F = None
        self.w: C = None
        self.o: F = None
        self.p: C = None
        self.txt = txt

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

g = A("g")
d = B("d")
j = C("j")
c = D("c")
h = E("h")
m = F("m")
f = F("f")
i = F("i")
b = E("b")

g.s = m
g.y = d
g.u = c
d.o = g
d.y = g
j.o = g
j.u = f
c.q = b
c.s = d
c.r = m
h.y = f
h.w = j
h.p = j
h.o = m
m.u = g
m.p = f
f.u = g
f.p = m
i.u = g
i.p = m
b.y = m
b.w = j
b.p = j
b.o = i
assert g.u.q.o.p.p.u.txt == "
class A:
    def __init__(self, txt: str):
        self.s: F = None
        self.y: B = None
        self.u: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: F = None
        self.w: C = None
        self.o: F = None
        self.p: C = None
        self.txt = txt

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

g = A("g")
d = B("d")
j = C("j")
c = D("c")
h = E("h")
m = F("m")
f = F("f")
i = F("i")
b = E("b")

g.s = m
g.y = d
g.u = c
d.o = g
d.y = g
j.o = g
j.u = f
c.q = b
c.s = d
c.r = m
h.y = f
h.w = j
h.p = j
h.o = m
m.u = g
m.p = f
f.u = g
f.p = m
i.u = g
i.p = m
b.y = m
b.w = j
b.p = j
b.o = i
assert g.u.q.o.p.p.u.txt == "g"