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

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

class C:
    def __init__(self, txt: str):
        self.t: H = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: E = None
        self.y: F = None
        self.p: G = None
        self.u: E = None
        self.v: B = None
        self.o: H = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: C = None
        self.o: H = None
        self.p: H = None
        self.txt = txt

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

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

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

f = A("f")
n = B("n")
d = C("d")
k = D("k")
m = E("m")
c = F("c")
l = G("l")
g = H("g")

f.p = c
n.y = d
n.q = f
d.t = g
k.w = m
k.u = m
k.y = c
k.p = l
k.v = n
k.o = g
m.x = d
m.o = g
m.p = g
c.u = k
l.q = k
l.t = k
l.o = k
l.s = n
g.w = c
g.u = f
assert f.p.u.p.s.q.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: H = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: E = None
        self.y: F = None
        self.p: G = None
        self.u: E = None
        self.v: B = None
        self.o: H = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: C = None
        self.o: H = None
        self.p: H = None
        self.txt = txt

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

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

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

f = A("f")
n = B("n")
d = C("d")
k = D("k")
m = E("m")
c = F("c")
l = G("l")
g = H("g")

f.p = c
n.y = d
n.q = f
d.t = g
k.w = m
k.u = m
k.y = c
k.p = l
k.v = n
k.o = g
m.x = d
m.o = g
m.p = g
c.u = k
l.q = k
l.t = k
l.o = k
l.s = n
g.w = c
g.u = f
assert f.p.u.p.s.q.p.txt == "c"