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

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

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

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

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

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

g = A("g")
d = B("d")
c = C("c")
k = D("k")
h = E("h")
i = F("i")
a = A("a")

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

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

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

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

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

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

g = A("g")
d = B("d")
c = C("c")
k = D("k")
h = E("h")
i = F("i")
a = A("a")

g.s = a
g.u = c
g.o = k
d.r = c
d.w = c
d.o = c
d.v = i
c.v = i
c.w = a
k.r = h
k.p = a
k.q = d
h.z = k
h.u = i
i.r = g
i.t = c
a.s = g
a.u = c
a.o = k
assert k.p.s.u.txt == "c"