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

class B:
    def __init__(self, txt: str):
        self.s: A = None
        self.v: E = None
        self.z: E = None
        self.o: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.v: A = None
        self.txt = txt

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

g = A("g")
c = B("c")
m = C("m")
i = D("i")
f = E("f")

g.t = i
g.y = i
g.q = f
c.s = g
c.o = g
c.v = f
c.z = f
m.x = f
m.o = f
i.v = g
f.p = i
assert c.z.p.v.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.q: E = None
        self.y: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: A = None
        self.v: E = None
        self.z: E = None
        self.o: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.v: A = None
        self.txt = txt

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

g = A("g")
c = B("c")
m = C("m")
i = D("i")
f = E("f")

g.t = i
g.y = i
g.q = f
c.s = g
c.o = g
c.v = f
c.z = f
m.x = f
m.o = f
i.v = g
f.p = i
assert c.z.p.v.txt == "g"